package com.learn.dept.controller;

import com.learn.dept.service.DeptService;
import com.learn.model.Dept;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
public class DeptController {
    @Autowired
    private DeptService deptService;
    
    @PostMapping("/addDept")
    public String addDept(String name) {
        return deptService.addDept(name);
    }
    
    @PostMapping("/findOneDept")
    public Dept findOneDept(Integer id) {
        return deptService.findOnedept(id);
    }
    
    @PostMapping("/findAllDept")
    public List<Dept> findAllDept() {
        return deptService.findAllDept();
    }
}
